package me.ereach.lambdas;

import java.util.function.Predicate;

public class MainPredicates {
    public static void main(String[] args) {
        Predicate<String> isLongThan5 = x -> x.length() > 5;
        System.out.println(isLongThan5.test("Hello, World"));

        Predicate<String> hasLeftBrace = x -> x.startsWith("{");
        Predicate<String> hasRightBrace = x -> x.endsWith("}");
        System.out.println(hasLeftBrace.and(hasRightBrace).test("{name=jinzd}"));

        Predicate<String> hasLeftAndRightBraces = hasLeftBrace.and(hasRightBrace);
        System.out.println(hasLeftAndRightBraces.test("{gender=male}"));
    }
}
